package com.sapient.mompoc.model;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * An Order class that represents the underlying data model.
 * 
 * @author asudar
 */
public class Order implements Serializable {
	private static final long serialVersionUID = 1L;

	private Long orderId;

	private ArrayList<LineItem> lineItems;

	public Order() {
		lineItems = new ArrayList<LineItem>();
	}

	public Order(Long orderId, ArrayList<LineItem> lineItems) {
		this.orderId = orderId;
		this.lineItems = lineItems;
	}

	/**
	 * @return the orderId
	 */
	public Long getOrderId() {
		return orderId;
	}

	/**
	 * @param orderId
	 *            the orderId to set
	 */
	public void setOrderId(Long orderId) {
		this.orderId = orderId;
	}

	/**
	 * @return the lineItems
	 */
	public ArrayList<LineItem> getLineItems() {
		return lineItems;
	}

	/**
	 * @param items
	 *            the lineItems to set
	 */
	public void setLineItems(ArrayList<LineItem> items) {
		this.lineItems = items;
	}

	/**
	 * @param lineItem
	 *            A Line Item to add.
	 */
	public void addLineItem(LineItem lineItem) {
		lineItems.add(lineItem);
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Order [orderId=");
		builder.append(orderId);
		builder.append(", lineItems=");
		builder.append(lineItems);
		builder.append("]");
		return builder.toString();
	}

}
